package bean;
import java.security.MessageDigest;

public class MD5Bean {
	public MD5Bean() {

	}
	public String getMD5(String source_string) {
		String md5String ="";
	    try {
	      MessageDigest md = MessageDigest.getInstance("MD5");
	      md.update(source_string.getBytes());
	      byte[] digest = md.digest();
	      
	      final StringBuffer buffer = new StringBuffer();
			for (int i = 0; i < digest.length; ++i)
			{
	    		final byte b = digest[i];
	    		final int value = (b & 0x7F) + (b < 0 ? 128 : 0);
	    		buffer.append(value < 16 ? "0" : "");
	    		buffer.append(Integer.toHexString(value));
			}
			md5String=buffer.toString();	
	    
	    }
	    catch (Exception e) {
	      e.printStackTrace();
	    }
	    return md5String;
	  }
	 
}
